home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Documentation / d e v e l o p / Develop Issue 23 article / Geometry Sample / Headers / WindowObj.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-14  |  2.2 KB  |  104 lines  |  [TEXT/MPS ]

  1.  
  2.  
  3. #ifndef __WINDOWOBJ__
  4. #define __WINDOWOBJ__
  5.  
  6. #include <Types.h>
  7. #include <Events.h>
  8.  
  9. typedef struct WindowObj WindowObj, *WindowObjPtr, **WindowObjHndl;
  10.  
  11. typedef void (*DrawContentProcPtr)(WindowObjHndl obj, short depth);
  12. typedef void (*NotifyProcPtr)(WindowObjHndl obj, long message);
  13. typedef void (*ActivateProcPtr)(WindowObjHndl obj, Boolean activate);
  14. typedef void (*ClickProcPtr)(WindowObjHndl obj, EventRecord *event, long message);
  15. typedef void (*KeystrokeProcPtr)(WindowObjHndl obj, long message, short modifiers);
  16.  
  17. struct WindowObj {
  18.     WindowPtr            window;
  19.     OSType                type;
  20.     DrawContentProcPtr    draw;
  21.     NotifyProcPtr        notify;
  22.     KeystrokeProcPtr    keys;
  23.     ActivateProcPtr        activate;
  24.     ClickProcPtr        click;
  25.     Boolean                hasIdleTask;
  26.     unsigned long        refCon;
  27. };
  28.  
  29.  
  30. WindowObjHndl NewObjWindow(short windID, OSType type, Boolean itFloats,
  31.                     Boolean hasIdleTask, DrawContentProcPtr draw, KeystrokeProcPtr keys,
  32.                     ClickProcPtr click, ActivateProcPtr activate,
  33.                     NotifyProcPtr notify);
  34. void DisposeObjWindow(WindowObjHndl obj);
  35.  
  36.  
  37. //
  38. // Menus (duh)
  39. //
  40. enum {
  41.     kAppleMenu    = 128,
  42.         kAboutItem        = 1,
  43.  
  44.     kFileMenu    = 129,
  45.         kNewItem         = 1,
  46.         kOpenItem        = 3,
  47.         kCloseItem        = 4,
  48.         kQuitItem        = 6,
  49.  
  50.     kEditMenu    = 130,
  51.         kUndoItem        = 1,
  52.         kCutItem        = 3,
  53.         kCopyItem        = 4,
  54.         kPasteItem        = 5,
  55.         kClearItem        = 6,
  56.         kSelectAllItem    = 8
  57. };
  58.  
  59. //
  60. // Window notification messages
  61. //
  62. enum {
  63.     kCreateNotification = 1,
  64.     kIdleNotification,
  65.     kCloseNotification,
  66.     kDestroyNotification,
  67.     kAdjustMenusNotification,
  68.     kGrowWindowNotification,
  69.     
  70.     kUndoNotification,
  71.     kCutNotification,
  72.     kCopyNotification,
  73.     kPasteNotification,
  74.     kClearNotification,
  75.     kSelectAllNotification
  76. };
  77.  
  78. //
  79. // Misc
  80. //
  81. enum {
  82.     kAppWindowKind        = 99
  83. };
  84.  
  85. #if !defined(check)
  86.     #define check(some_expr) do {if (!(some_expr)) DebugStr("\pcheck failed");} while (0);
  87. #endif
  88.  
  89. #if !defined(require)
  90.     #define require(some_expr, some_label) do { if (!(some_expr)) \
  91.             {DebugStr("\prequire failed"); goto some_label;}} while (0);
  92. #endif
  93.  
  94. void pstrcpy(void *src, void *dest);
  95. void pstrcat(Str255 frontStr, ConstStr255Param backStr);
  96.  
  97. void DisableAllMenuItems(MenuHandle menu);
  98. void EnableAllMenuItems(MenuHandle menu);
  99. Boolean IsAppWindow(WindowPtr win);
  100. GrafPtr    SetupPort(GrafPtr port);
  101.  
  102.  
  103. #endif
  104.